// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-16

package services

import (
	"context"
	"server/app/http/models"
)

func (o *OauthService) GetByCode(ctx context.Context, code string) (model *models.Oauth, err error) {
	model, _, err = o.Dao.GetByMap(ctx, map[string]any{
		"user_code": code,
	})
	return
}

func (o *OauthService) SetUserId(ctx context.Context, model *models.Oauth) (affects int64, err error) {
	return o.Dao.UpdateFieldsById(ctx, map[string]any{
		"user_id": model.UserId,
	}, model.Id)
}
